package com.aracky.assess.schedule;

import com.aracky.assess.model.entity.HrKpiUserPerformanceHeader;
import com.aracky.assess.service.PushMsgService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tech.powerjob.worker.core.processor.ProcessResult;
import tech.powerjob.worker.core.processor.TaskContext;
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * 考核开启定时给未填报的员工发送消息，早上9:00一次,下午13:30一次
 */
@Component
public class SendMsgToEmployee implements BasicProcessor {
    private static Logger logger = LoggerFactory.getLogger(SendMsgToEmployee.class);

    @Autowired
    private PushMsgService pushMsgService;

    @Override
    public ProcessResult process(TaskContext taskContext) throws Exception {
        logger.info("员工任务发送开始时间：{}", LocalDateTime.now());

        List<HrKpiUserPerformanceHeader> headList=new ArrayList<>();

        pushMsgService.pushWriteMsgToEmployee(headList);

        return new ProcessResult(true, "员工任务消息发送成功" + LocalDateTime.now());
    }
}
